| GUI Help > Create > createCanvas | ||||||||||||||
|
createCanvas |
||||||||||||||
| int handle=createCanvas(int x, int y, int width, int height, handle parent) | ||||||||||||||
|
Description: Creates a canvas. Canvases are effectively blank drawing boards which you can draw on using the various drawing commands (drawLine, drawRect, drawEllipse and drawPoint). They have many uses, such as custom controls, or a painting surface in an image editor. |
||||||||||||||
|
Return Value: Handle to the new gadget. |
||||||||||||||
| Parameters: | ||||||||||||||
|
||||||||||||||
| Remarks:
You do not have to continually repaint canvases like you would with the normal 2D commands (dot, point, line). You only need to call the drawing commands when you wish to show a visual change in the appearence of the canvas. Use the setDrawingColor command to set the colour used by the drawing commands. At the time of writing, canvas gadget drawing is much faster than using the ordinary 2D commands, so they may be useful as replacements. setDrawingColor in particular may be done frequently unlike the INK command. However, resizing a canvas is a slow operation as the plugin has to recreate all of its internal memory buffers. Also for this reason, a gadget is wiped clean when you resize it. |
||||||||||||||
| See Also:
|
||||||||||||||
|
Example: (Note: You will need to include the GUI constants file for this example to work) |